<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<style>
.all_list select {
	width: 120px;
}
</style>
<div class="r_location">
	<i class="r_txtico"></i> 内容管理&gt; 会员管理 
</div>
<div class="m-t10">
	
	<div class="clearfix table_fn">
			<span class="l">会员管理数据列表</span> <span class="r"
				style="_margin-top: 5px;"> <a href="#" title="" class="add_ico" onclick="addAbout()" id="add_term">新增</a>
			</span>
	</div>
	
	<table id="about_table">
	</table>
	<div id="pgtoolbar"></div>
</div>
<script>
   function addAbout(){
		to_page('/cms/member/add/page');
   }

	function modify(id){
		to_page('/cms/member/modify/page?id='+id);
	}
	
	function del(id){
		art.dialog({
			title : '删除',
			lock : true,
			content : '确认删除?',
			width : '200px',
		    cancelVal: '关闭',
		    cancel: true,
			ok : function () {
				$.post("cms/member/delete", {id:id}, function(data) {
					//if(data.code!="01"){
						$("#about_table").jqGrid("setGridParam", {
							datatype : "json"
						}).trigger("reloadGrid", [ {
							page : 1
						} ]);
					//}
				});
			}
		});
	}
 
 
	$(function() {
		$.jgrid.ajaxOptions.type = 'post';
		$("#about_table").jqGrid({
			url : "cms/member/view",
			datatype : "json",
			colModel : [{
				label : '会员名称',
				name : 'memberName',
				index : 'memberName',
				width:50
			},  {
				label : '会员等级',
				name : 'memberLevel',
				index : 'memberLevel',
				width:50
			},  {
				label : '创建时间',
				name : 'createDate',
				index : 'createDate',
				width:60
			},  {
				label : '积分',
				name : 'integral',
				index : 'integral',
				width:60
			},  {
				label : '描述',
				name : 'remark',
				index : 'remark',
				width:200,
				formatter:function(cell,options,row){
				
					return row.remark;
					
				}
			},  {
				label : '状态',
				name : 'stats',
				index : 'stats',
				width:100,
				formatter:function(cell,options,row){
					if(row.stats == 1){
						return "上架";
					}else{
						return "下架";
					}
				}
			}, {
				label : '操作',
				name : 'operation',
				index : 'operation',
				width: 50,
				formatter:function(cell,options,row){
					var result = '';
					result = '<a href="#" onclick="modify(\''+row.id+'\')">修改</a>';
					result = result + ' <a href="#" onclick="del(\''+row.id+'\')">删除</a>';
					return result;
				}
			}],
			height : 370,
			rowNum : 10,
			rowList : [ 10, 20, 30 ],
			viewrecords : true,
			pager : '#pgtoolbar',
			autowidth : true,
			rownumbers : true,
			jsonReader : {
				root : "data",//当前记录
				page : "index",
				records : "totalRecord",//总记录数
				total : 'total',//总页数
				id : 'data.id',
				repeatitems : false
			}
			
		});
		function serialize_list(cell,options,row){
			var result = new Array();
			for(var i=0;i<cell.length;i++){
				result[i] = cell[i].name;
			}
			return result.join(';');
		};
	});
</script>